/**
    ATClab - scriptable Air Traffic Control simulations.
    Copyright (C) 2010 openatclab@gmail.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
**/

#ifndef __PERFORMANCE_DATA_PARSER_HDR__
#define __PERFORMANCE_DATA_PARSER_HDR__

#ifdef WIN32
	#pragma warning( disable : 4786 )
#endif


#include <iostream>
#include <vector>


namespace performance {

    //
    // performance::Builder
    //
    class Builder;

	//
	// performance::InputStatus
	//
	enum InputState {
		    CLASS_NO
		  , AC_TYPE
		  , HOLDING_SPEEDS
		  , TAKEOFF_PARAMS
		  , LANDING_SPEED
		  , RADAR_XSECTION
		  , MAXIMUM_PARAMS
		  , STD_TURN_SPEED
		  , TURN_RATES
		  , ACCELERATIONS
		  , DECELERATIONS
		  , CLIMB_RATES
		  , DESCEND_RATES
		  , LEVELS
		  , LVL_ALTITUDES
		  , LVL_CLIMB_RATES
		  , LVL_DESCEND_RATES
		  , LVL_ACCELERATIONS
		  , LVL_DECERATIONS
		  , LVL_CRUISING_SPEEDS
		  , LVL_STALL_SPEEDS
		  , LVL_CLIMBING_SPEEDS
		  , LVL_DESCENDING_SPEEDS
		  , SID_STAR
	};

    //
    // Parser
    //
    class Parser {

    public:
        Parser( std::istream &, Builder & );
		~Parser();

    public:
        void parse();

	private:
		// generic
		void Parser::process_double(
				std::istream &
			  , void (Builder::*)( double ) 
		);
		void process_doubles(
				std::istream &
			  , const int
			  , void (Builder::*)( const std::vector< double > & ) 
		);
		void process_range( 
				std::istream &
			  , void (Builder::*)( double, double, double ) 
		);
		void process_string(
				std::istream &
			  , void (Builder::*)( const std::string & ) 
		);
		void process_strings(
				std::istream &
			  , const int
			  , void (Builder::*)( const std::vector< std::string > & ) 
		);

		// specific
		void process_takeoff(
				std::istream &is
			  , void (Builder::*)( double, double, double, double ) 
		);

	private:
		std::istream &_instream;
		Builder      &_builder;

    };
        


};
#endif
